import { request } from '@/utils/request'
import type { LoginParams, LoginResultDTO } from '@/types/auth'

// 登录接口
export function login(data: LoginParams) {
  return request<LoginResultDTO>({
    url: '/auth/login',
    method: 'post',
    data
  })
}

// 获取用户信息
export function getInfo() {
  return request({
    url: '/auth/getInfo',
    method: 'get'
  })
}

// 刷新令牌
export function refreshToken(refreshToken: string) {
  return request({
    url: '/auth/refresh',
    method: 'post',
    data: { refreshToken }
  })
}

// 登出
export function logout() {
  return request({
    url: '/auth/logout',
    method: 'post'
  })
}
